<template>
  <v-app>
    <router-view @toast="toast"/>

    <v-snackbar
        v-model="showToastMsg"
        :timeout="toastTimeOut"
    >
      <span :class="warning?'red--text':''">
      {{ toastMsg }}
      </span>
    </v-snackbar>

  </v-app>
</template>

<script>

export default {
  name: 'App',
  data: () => ({
    showToastMsg: false,
    toastMsg: '',
    toastTimeOut: 3000,
    warning: ''
  }),
  methods: {
    toast(msg, timeOut = 3000, warning = false) {
      this.showToastMsg = true;
      this.toastTimeOut = timeOut
      this.toastMsg = msg
      this.warning = warning
    }
  }
};
</script>
